package com.adinnet.admin.link.controller;


import com.adinnet.admin.address.mapper.AddressMapper;
import com.adinnet.admin.address.model.Address;
import com.adinnet.admin.contact.model.vo.ContactResp;
import com.adinnet.admin.link.model.Link;
import com.adinnet.admin.link.model.vo.LinkReq;
import com.adinnet.admin.link.service.LinkService;
import com.adinnet.core.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 意向客户（被分享录入） 前端控制器
 * </p>
 *
 * @author chenjia
 * @since 2020-12-21
 */
@Controller
@RequestMapping("admin/link")
public class LinkController {


    @Autowired
    private LinkService linkService;

    @Autowired
    private AddressMapper addressMapper;

    @RequestMapping()
    public String link(Model model) {
        model.addAttribute("provinceList", addressMapper.selectList(new QueryWrapper<Address>().eq("type", 1).eq("deleted", 0)));//省列表
        return "link/link.html";
    }


    /**
     * 意向客户列表
     **/
    @ResponseBody
    @RequestMapping("/list")
    public PageResult<Link> list(LinkReq linkReq) {
        return linkService.contactList(linkReq);
    }

}
